<ui:component xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
  xmlns:composite="http://java.sun.com/jsf/composite"
  xmlns:p="http://primefaces.org/ui">
  <composite:interface>  
    <composite:attribute name="type"/>
    <composite:attribute name="elementId"/> 
    <composite:attribute name="size"/> <!-- small medium big -->
  </composite:interface>
  <composite:implementation>   
  	<h:panelGroup styleClass="photo #{cc.attrs.size}">
	    <p:graphicImage rendered='#{cc.attrs.type == "book"}' value="#{bookController.photo}">
	 		<f:param name="bookId" value="#{cc.attrs.elementId}" />
	    </p:graphicImage>	    
	    <p:graphicImage rendered='#{cc.attrs.type == "client"}' value="#{clientController.photo}">
	 		<f:param name="clientId" value="#{cc.attrs.elementId}" />
	    </p:graphicImage>
    </h:panelGroup>
  </composite:implementation>
</ui:component>